<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>{dreamer-cms:global name="title" /}-{dreamer-cms:category field="typenamecn" /}</title>
  <link rel="icon" href="{dreamer-cms:template /}images/favicon.ico" />
  <meta name="Keywords" content="{dreamer-cms:global name='keywords' /}" />
  <meta name="Description" content="{dreamer-cms:global name='describe' /}" />
  <link href="{dreamer-cms:template /}css/output.css" rel="stylesheet" />
  <link rel="stylesheet" href="{dreamer-cms:template /}css/variables.css" />
</head>

<body class="bg-white">
  <!-- 导航栏 -->
  <div class="sticky top-0 z-50">
    {dreamer-cms:include file='inc/header.html'/}
  </div>
  <p id="listCatUrl" class="hidden">{dreamer-cms:category field="visiturl" /}</p>
  <main>
    <div class="container mx-auto mt-8 lg:mt-24">
      <img src='{dreamer-cms:topcategory field="typeimg" /}' class="w-full mb-4 md:mb-12" alt="">
      <div class="grid grid-cols-1 lg:flex lg:space-x-24 lg:flex-wrap">
        {dreamer-cms:channel typeid="w8yy24je" showall="false" type="son"}
        <a href="[field:typeurl /]"
          class="tab-button py-4 text-xl text-center md:text-2xl lg:text-4xl font-medium hover:text-[#FFB300] border-b-[4px] border-transparent transition-colors duration-300"
          data-tab="tab[field:autoindex/]">[field:description /]</a>
        {/dreamer-cms:channel}
      </div>
      <img src='{dreamer-cms:category field="typeimg" /}' class="w-full mb-4 md:mb-12" alt="">
    </div>
    <div class="container px-4 lg:px-0 pb-4 lg:pb-10 mx-auto mt-10 lg:mt-16">
      <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2">
        {dreamer-cms:pagelist }
        <a href="[field:arcurl /]" class="w-full relative aspect-[2/1]">
          <img src="[field:litpic /]" class="w-full h-full aspect-[2/1] object-cover rounded-2xl ratio-2/1"
            alt="[field:title /]" />
          <div
            class="absolute inset-0 rounded-2xl bg-black/70 opacity-0 hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center text-base md:text-xl xl:text-3xl font-medium text-[#E0E4E8]">
            <p>[field:title /]</p>
          </div>
        </a>
        {/dreamer-cms:pagelist}
      </div>
    </div>


  </main>
  <!-- 页脚 -->
  {dreamer-cms:include file="inc/footer.html" /}

  <!-- JavaScript -->
  <script>

    window.addEventListener('resize', handleTabBehavior);

    // 初始化时执行一次
    handleTabBehavior();

    function handleTabBehavior() {
      const tabButtons = document.querySelectorAll('.tab-button');
      const tabPanes = document.querySelectorAll('.lg\\:tab-pane');

      if (window.innerWidth >= 1024) {
        // 大屏幕启用Tab切换

        const listCatUrlElement = document.getElementById('listCatUrl');
        if (listCatUrlElement) {
          const listCatUrl = listCatUrlElement.textContent.trim();
          const categoryItems = document.querySelectorAll('.tab-button');

          categoryItems.forEach(link => {
            if (link.href.includes(listCatUrl.trim())) {
              // 当 visitUrl 不为 '/' 时，正常匹配
              link.classList.remove('border-transparent');
              link.classList.add('text-[#FFB300]', '!border-[#FFB300]');
            }
          });
        }
      } else {
        // 小屏幕显示所有内容
        tabPanes.forEach(pane => {
          pane.classList.remove('hidden');
        });
      }
    }



  </script>
</body>

</html>